import express from 'express';
import multer from 'multer';
import { uploadFile } from '../controllers/uploadToObs';
import { tokenVerification } from '../middlewares/tokenVerification';
// 强制将 tokenVerification 转换为 RequestHandler 类型
import { RequestHandler } from 'express';

const router = express.Router();

// 使用 multer 中间件进行文件处理
const upload = multer({ dest: 'uploads/' });

// 定义上传文件的路由，强制将 tokenVerification 转为 RequestHandler 类型
router.post('/upload', tokenVerification as RequestHandler, upload.single('file'), uploadFile);

export default router;
 